﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data.Entity;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace MyWPF.Models.SQL
{
    public interface ISql
    {
        /// <summary>
        /// 加载数据库
        /// </summary>
        /// <param name="sqlConfig"></param>
        void LoadSQL(SqlContext sql);

        void AddTable(TableContext table);
    }

    /// <summary>
    /// 数据库
    /// </summary>
    public class SqlContext
    {
        /// <summary>
        /// 连接地址
        /// </summary>
        public string Server { get; set; }
        /// <summary>
        /// 连接用户名
        /// </summary>
        public string User { get; set; }
        /// <summary>
        /// 密码
        /// </summary>
        public string Password { get; set; }
        /// <summary>
        /// 数据库存放地址
        /// </summary>
        public string Path { get; set; }
    }

    /// <summary>
    /// 表内容
    /// </summary>
    public class TableContext
    {
        /// <summary>
        /// ID
        /// </summary>
        [Key]
        [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
        public int ID { get; set; }

        /// <summary>
        /// 时间
        /// </summary>
        [Required]
        public DateTime Time { get; set; }

        /// <summary>
        /// 备注
        /// </summary>
        [MaxLength(200)]
        public string Remarks { get; set; }

    }

 
}
